package com.bml.architect.rabbitmq.routing;

import com.bml.architect.rabbitmq.utils.RabbitConstant;
import com.bml.architect.rabbitmq.utils.RabbitUtils;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class Weather {

    public static void main(String[] args) throws Exception {

        Connection connection = RabbitUtils.getConnection();
        Channel channel = connection.createChannel();

        Map<String,String> param = new HashMap<>();
        param.put("sc.chengdu.20210201","四川成都20210201的天气多云");
        param.put("sc.deyang.20210201","四川德阳20210201的天气阴天");
        param.put("sc.yaan.20210201","四川雅安20210201的天气晴");
        param.put("sc.mianyang.20210201","四川绵阳20210201的天气小雨");

        param.put("hb.shijianzhuang.20210202","河北石家庄20210202的天气多云");
        param.put("hb.baoding.20210202","河北保定20210202的天气阴天");
        param.put("hb.hengshui.20210202","河北衡水20210202的天气晴");
        param.put("sc.qinghuangdao.20210202","河北秦皇岛20210202的天气小雨");

        for (Map.Entry<String,String> map : param.entrySet()){
            String key = map.getKey();
            String value = map.getValue();
            channel.basicPublish(RabbitConstant.exchange_weather,key,null,value.getBytes());
        }



    }
}
